<?php
declare (strict_types=1);

namespace app\data\model;

use think\Model;

/**
 * 产品属性表
 * @mixin \think\Model
 */
class ProductsAttrsModel extends BaseModel
{
    protected $pk = 'id';

    protected $schema = [
        'id' => 'bigint',
        'parent_id' => 'int',
        'name' => 'varchar',
        'sort' => 'int',
        'is_show' => 'tinyint',
        'ver' => 'bigint',
        'create_time' => 'int',
        'update_time' => 'int',
        'delete_time' => 'int',
    ];

    /**
     * 子属性
     * @return \think\model\relation\HasMany
     */
    public function children()
    {
        return $this->hasMany(ProductsAttrsModel::class, 'parent_id', 'id')->where('delete_time', 0);
    }
}
